home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / iqb9109.zip / LPTSTAT.FUN < prev    next >
Text File  |  1991-09-09  |  1KB  |  35 lines

  1. DEFINT A-Z
  2.  
  3. FUNCTION LptStat% (PrinterNumber%)
  4.  
  5. ' Copyright 1988 MicroHelp, Inc. - All Rights Reserved
  6.  
  7. ' Function: Returns the printer status.
  8.  
  9. ' Input   : PrinterNumber% is the printer to test.
  10.  
  11. ' Output  : An integer result. If 0, the printer is ready and waiting.
  12. '           If non-zero, use BitIsOn% to check for:
  13.  
  14. '             Bit Number        Indication
  15. '                 7             Busy
  16. '                 6             Acknowledge
  17. '                 5             Out of paper
  18. '                 4             Selected
  19. '                 3             I/O error
  20. '                 2             Not used
  21. '                 1             No printer available
  22. '                 0             Time out
  23.      
  24.     DEF SEG = 0
  25.     Location = PrinterNumber * 2 + &H406
  26.     Address = PEEK(Location) + 256 * PEEK(Location + 1)
  27.     IF Address THEN
  28.        LptStat = (INP(Address + 1) AND &HF8) XOR 200
  29.     ELSE
  30.        LptStat = 2                  ' No printer available
  31.     END IF
  32.     DEF SEG
  33.     
  34. END FUNCTION
  35.